]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Drop restarting capapbility
authorBilal Elmoussaoui <belmouss@redhat.com>
Tue, 4 Nov 2025 14:41:49 +0000 (15:41 +0100)
committerMarge Bot <marge-bot@gnome.org>
Wed, 5 Nov 2025 11:48:06 +0000 (11:48 +0000)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3768>

js/ui/layout.js
js/ui/main.js
js/ui/runDialog.js
man/gnome-shell.rst
src/gnome-shell-test-tool.in
src/main.c
src/shell-global.c
src/shell-global.h

index fa4c5b0575722ac5fe940391545341befedcfe78..a13ba6205a2db7edfa6fc93c22358cf37ddf2829 100644 (file)
@@ -729,9 +729,7 @@ export const LayoutManager = GObject.registerClass({
         // windows restore to the right size.
         this._updateRegions();
 
-        if (Meta.is_restart()) {
-            // On restart, we don't do an animation.
-        } else if (Main.sessionMode.isGreeter) {
+        if (Main.sessionMode.isGreeter) {
             this.panelBox.translation_y = -this.panelBox.height;
         } else {
             this.keyboardBox.hide();
@@ -768,9 +766,6 @@ export const LayoutManager = GObject.registerClass({
     }
 
     async _startupAnimation() {
-        if (Meta.is_restart())
-            return;
-
         if (Main.sessionMode.isGreeter)
             await this._startupAnimationGreeter();
         else
index c8cf0c9bb5842b8455018151f81a48227e54af04..c911ab21724c4d1d1d4cf1b7d926f9e581d725c0 100644 (file)
@@ -1,4 +1,3 @@
-import Clutter from 'gi://Clutter';
 import Gio from 'gi://Gio';
 import GioUnix from 'gi://GioUnix';
 import GLib from 'gi://GLib';
@@ -21,7 +20,6 @@ import * as InputMethod from '../misc/inputMethod.js';
 import * as Introspect from '../misc/introspect.js';
 import * as Keyboard from './keyboard.js';
 import * as MessageTray from './messageTray.js';
-import * as ModalDialog from './modalDialog.js';
 import * as OsdWindow from './osdWindow.js';
 import * as OsdMonitorLabeler from './osdMonitorLabeler.js';
 import * as Overview from './overview.js';
@@ -288,16 +286,6 @@ async function _initializeUI() {
         locatePointer.show();
     });
 
-    global.display.connect('show-restart-message', (display, message) => {
-        showRestartMessage(message);
-        return true;
-    });
-
-    global.display.connect('restart', () => {
-        global.reexec_self();
-        return true;
-    });
-
     global.display.connect('gl-video-memory-purged', loadTheme);
 
     global.context.connect('notify::unsafe-mode', () => {
@@ -1019,32 +1007,6 @@ export function queueDeferredWork(workId) {
     }
 }
 
-const RestartMessage = GObject.registerClass(
-class RestartMessage extends ModalDialog.ModalDialog {
-    _init(message) {
-        super._init({
-            shellReactive: true,
-            styleClass: 'restart-message',
-            shouldFadeIn: false,
-            destroyOnClose: true,
-        });
-
-        const label = new St.Label({
-            text: message,
-            x_align: Clutter.ActorAlign.CENTER,
-            y_align: Clutter.ActorAlign.CENTER,
-        });
-
-        this.contentLayout.add_child(label);
-        this.buttonLayout.hide();
-    }
-});
-
-function showRestartMessage(message) {
-    const restartMessage = new RestartMessage(message);
-    restartMessage.open();
-}
-
 class AnimationsSettings {
     constructor() {
         this._animationsEnabled = true;
index 9c347ed3cbe8fc6e8a36ba6432816bc7ce24970e..2d6c717047bcb0ad5a274c57e04523d1033d6da4 100644 (file)
@@ -2,7 +2,6 @@ import Clutter from 'gi://Clutter';
 import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
-import Meta from 'gi://Meta';
 import Shell from 'gi://Shell';
 import St from 'gi://St';
 
@@ -40,11 +39,6 @@ class RunDialog extends ModalDialog.ModalDialog {
         this._internalCommands = {
             'lg': () => Main.createLookingGlass().open(),
 
-            'r': this._restart.bind(this),
-
-            // Developer brain backwards compatibility
-            'restart': this._restart.bind(this),
-
             'debugexit': () => global.context.terminate(),
 
             // rt is short for "reload theme"
@@ -251,15 +245,6 @@ class RunDialog extends ModalDialog.ModalDialog {
         this._descriptionLabel.set_text(message);
     }
 
-    _restart() {
-        if (Meta.is_wayland_compositor()) {
-            this._showError(_('Restart is not available on Wayland'));
-            return;
-        }
-        this._shouldFadeOut = false;
-        this.close();
-        Meta.restart(_('Restarting…'), global.context);
-    }
 
     open() {
         this._history.lastItem();
index bd89f9f4f963833bfb81c38b67a3ce378a35b61d..c577e91aaa333e9c0b43d3c9047dc20af345aa21 100644 (file)
@@ -43,10 +43,6 @@ OPTIONS
 
   Wayland display name to use
 
-``-r``, ``--replace``
-
-  Replace the running window manager
-
 ``--mode=MODE``
 
   Use a specific mode, e.g. "gdm" for login screen
index 536409348def95c8f3827a633af63360f00b0088..b3197878bbd2837a954c98a65a94af60c075cf09 100755 (executable)
@@ -49,9 +49,6 @@ def start_shell(wrap=None, perf_output=None):
 
     args.append('--force-animations')
 
-    if options.replace:
-        args.append('--replace')
-
     if options.wayland or options.nested or options.headless:
         args.append('--wayland')
         if options.nested:
@@ -81,13 +78,6 @@ def run_shell(wrap=None, perf_output=None):
     shell.wait()
     return shell.returncode == 0
 
-def restore_shell():
-    pid = os.fork()
-    if (pid == 0):
-        os.execlp("gnome-shell", "gnome-shell", "--replace")
-    else:
-        sys.exit(0)
-
 def upload_performance_report(report_text):
     try:
         config_home = os.environ['XDG_CONFIG_HOME']
@@ -309,8 +299,6 @@ parser.add_argument("--version", action="version",
 
 parser.add_argument("--wrap")
 
-parser.add_argument("-r", "--replace", action="store_true",
-                    help="Replace the running window manager")
 parser.add_argument("-w", "--wayland", action="store_true",
                     help="Run as a Wayland compositor")
 parser.add_argument("-n", "--nested", action="store_true",
@@ -331,8 +319,5 @@ if options.script == 'hwtest':
     options.extra_filter.append('Gedit')
 
 normal_exit = run_performance_test(wrap=options.wrap)
-if normal_exit:
-    if not options.hwtest and options.replace:
-        restore_shell()
-else:
+if not normal_exit:
     sys.exit(1)
index 7feef04b7c1a7bf9b1841c7b693ce4637c939462..2cef065f94d1f3b06a66fd43ba8ea252818a005a 100644 (file)
@@ -82,7 +82,7 @@ shell_dbus_acquire_name (GDBusProxy  *bus,
 }
 
 static void
-shell_dbus_init (gboolean replace)
+shell_dbus_init ()
 {
   GDBusConnection *session;
   GDBusProxy *bus;
@@ -113,8 +113,6 @@ shell_dbus_init (gboolean replace)
     }
 
   request_name_flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;
-  if (replace)
-    request_name_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE;
 
   shell_dbus_acquire_name (bus,
                            request_name_flags,
@@ -123,7 +121,7 @@ shell_dbus_init (gboolean replace)
   if (!(request_name_result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER
         || request_name_result == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER))
     {
-      g_printerr (SHELL_DBUS_SERVICE " already exists on bus and --replace not specified\n");
+      g_printerr (SHELL_DBUS_SERVICE " already exists on bus\n");
       exit (1);
     }
 
@@ -668,7 +666,7 @@ main (int argc, char **argv)
 
   shell_init_debug (g_getenv ("SHELL_DEBUG"));
 
-  shell_dbus_init (meta_context_is_replacing (context));
+  shell_dbus_init ();
   shell_a11y_init ();
   shell_perf_log_init ();
   shell_introspection_init ();
index f4c69e0d3f16b8115b5d4e9262cb037c11922964..95f4f36791f24e20f8f4307588f5a0cb42ce54c4 100644 (file)
@@ -1067,191 +1067,6 @@ _shell_global_get_gjs_context (ShellGlobal *global)
  * http://bugzilla.gnome.org/show_bug.cgi?id=357585
  */
 
-static int
-set_cloexec (void *data, gint fd)
-{
-  if (fd >= GPOINTER_TO_INT (data))
-    fcntl (fd, F_SETFD, FD_CLOEXEC);
-
-  return 0;
-}
-
-#ifndef HAVE_FDWALK
-static int
-fdwalk (int (*cb)(void *data, int fd), void *data)
-{
-  gint open_max;
-  gint fd;
-  gint res = 0;
-
-#ifdef HAVE_SYS_RESOURCE_H
-  struct rlimit rl;
-#endif
-
-#ifdef __linux__
-  DIR *d;
-
-  if ((d = opendir("/proc/self/fd"))) {
-      struct dirent *de;
-
-      while ((de = readdir(d))) {
-          glong l;
-          gchar *e = NULL;
-
-          if (de->d_name[0] == '.')
-              continue;
-
-          errno = 0;
-          l = strtol(de->d_name, &e, 10);
-          if (errno != 0 || !e || *e)
-              continue;
-
-          fd = (gint) l;
-
-          if ((glong) fd != l)
-              continue;
-
-          if (fd == dirfd(d))
-              continue;
-
-          if ((res = cb (data, fd)) != 0)
-              break;
-        }
-
-      closedir(d);
-      return res;
-  }
-
-  /* If /proc is not mounted or not accessible we fall back to the old
-   * rlimit trick */
-
-#endif
-
-#ifdef HAVE_SYS_RESOURCE_H
-  if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY)
-      open_max = rl.rlim_max;
-  else
-#endif
-      open_max = sysconf (_SC_OPEN_MAX);
-
-  for (fd = 0; fd < open_max; fd++)
-      if ((res = cb (data, fd)) != 0)
-          break;
-
-  return res;
-}
-#endif
-
-static void
-pre_exec_close_fds(void)
-{
-  fdwalk (set_cloexec, GINT_TO_POINTER(3));
-}
-
-/**
- * shell_global_reexec_self:
- * @global: A #ShellGlobal
- *
- * Restart the current process.  Only intended for development purposes.
- */
-void
-shell_global_reexec_self (ShellGlobal *global)
-{
-  GPtrArray *arr;
-  gsize len;
-  MetaContext *meta_context;
-
-#if defined __linux__ || defined __sun
-  char *buf;
-  char *buf_p;
-  char *buf_end;
-  g_autoptr (GError) error = NULL;
-
-  if (!g_file_get_contents ("/proc/self/cmdline", &buf, &len, &error))
-    {
-      g_warning ("failed to get /proc/self/cmdline: %s", error->message);
-      return;
-    }
-
-  buf_end = buf+len;
-  arr = g_ptr_array_new ();
-  /* The cmdline file is NUL-separated */
-  for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1)
-    g_ptr_array_add (arr, buf_p);
-
-  g_ptr_array_add (arr, NULL);
-#elif defined __OpenBSD__
-  gchar **args, **args_p;
-  gint mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV };
-
-  if (sysctl (mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1)
-    return;
-
-  args = g_malloc0 (len);
-
-  if (sysctl (mib, G_N_ELEMENTS (mib), args, &len, NULL, 0) == -1) {
-    g_warning ("failed to get command line args: %d", errno);
-    g_free (args);
-    return;
-  }
-
-  arr = g_ptr_array_new ();
-  for (args_p = args; *args_p != NULL; args_p++) {
-    g_ptr_array_add (arr, *args_p);
-  }
-
-  g_ptr_array_add (arr, NULL);
-#elif defined __FreeBSD__
-  char *buf;
-  char *buf_p;
-  char *buf_end;
-  gint mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, getpid() };
-
-  if (sysctl (mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1)
-    return;
-
-  buf = g_malloc0 (len);
-
-  if (sysctl (mib, G_N_ELEMENTS (mib), buf, &len, NULL, 0) == -1) {
-    g_warning ("failed to get command line args: %d", errno);
-    g_free (buf);
-    return;
-  }
-
-  buf_end = buf+len;
-  arr = g_ptr_array_new ();
-  /* The value returned by sysctl is NUL-separated */
-  for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1)
-    g_ptr_array_add (arr, buf_p);
-
-  g_ptr_array_add (arr, NULL);
-#else
-  return;
-#endif
-
-  /* Close all file descriptors other than stdin/stdout/stderr, otherwise
-   * they will leak and stay open after the exec. In particular, this is
-   * important for file descriptors that represent mapped graphics buffer
-   * objects.
-   */
-  pre_exec_close_fds ();
-
-  meta_context = shell_global_get_context (global);
-  meta_context_restore_rlimit_nofile (meta_context, NULL);
-
-  meta_display_close (shell_global_get_display (global),
-                      shell_global_get_current_time (global));
-
-  execvp (arr->pdata[0], (char**)arr->pdata);
-  g_warning ("failed to reexec: %s", g_strerror (errno));
-  g_ptr_array_free (arr, TRUE);
-#if defined __linux__ || defined __FreeBSD__
-  g_free (buf);
-#elif defined __OpenBSD__
-  g_free (args);
-#endif
-}
-
 /**
  * shell_global_notify_error:
  * @global: a #ShellGlobal
index 4894d8b4e6f8390bf72fc120a1d18576680b2888..3bbe3e0ab1e152b085037ff15d4044dc23f803df 100644 (file)
@@ -90,8 +90,6 @@ void     shell_global_notify_error              (ShellGlobal  *global,
                                                  const char   *msg,
                                                  const char   *details);
 
-void     shell_global_reexec_self               (ShellGlobal  *global);
-
 const char *     shell_global_get_session_mode  (ShellGlobal  *global);
 
 void     shell_global_set_runtime_state         (ShellGlobal  *global,